def multip_table():
    while True:
        while True:
            start = input("请输入起始值(q退出)：")
            if start == 'q':
                return
            elif not start.isdigit():
                print("请输入数字，请重新输入")
            else:
                break
        while True:
            end = input("请输入结束值(q退出)：")
            if start == 'q':
                return
            elif not end.isdigit():
                print("请输入数字，请重新输入")
            else:
                break
        if int(start) > int(end):
            tmp = start
            start = end
            end = tmp
        for i in range(int(start), int(end) + 1):
            for j in range(int(start), i + 1):
                print("{} × {} = {}".format(j, i, i * j), end="\t")
            print(end="\n")


multip_table()
